package com.gycode.vpush.enums;

import lombok.Getter;

@Getter
public enum WebSocketEnum {

    MSG_TYPE1(1, "webSocket"),
    MSG_TYPE2(2, "短信"),
    MSG_TYPE3(3, "邮件"),
    SOCKET_TYPE0(0, "定时消息"),
    SOCKET_TYPE1(1, "及时消息"),
    ;

    private Integer code;

    private String msg;

    WebSocketEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 通过状态码获取枚举对象
     *
     * @param code 状态码
     * @return 枚举对象
     */
    public static ResultEnum getByCode(int code) {
        for (ResultEnum resultEnum : ResultEnum.values()) {
            if (code == resultEnum.getCode()) {
                return resultEnum;
            }
        }
        return null;
    }
}
